//
//  NetworkTools.h
//  weibo
//
//  Created by qiuming on 15/12/21.
//  Copyright © 2015年 qiuming. All rights reserved.
//

#import <AFNetworking/AFNetworking.h>
/// 网络请求类型
typedef NS_ENUM(NSUInteger, RequestMethod) {
    GET,
    POST
};

typedef void (^requestCallBack)(id result, NSError *error);

/// 回调地址
extern NSString *const REDIRECT_URL;

@interface NetworkTools : AFHTTPSessionManager

// OAuth认证回调地址,由appKey和回调地址返回code
/// @see(http://open.weibo.com/wiki/Oauth2/authorize)
@property (strong, nonatomic, readonly) NSURL *oauthUrl;

/// 网络请求工具类
+ (instancetype)sharedNetwordTool;


/// 使用授权码，获取Token
///
/// @param code   授权码
/// @param finish 完成时回调
- (void)accessTokenWithCode:(NSString *)code finish:(requestCallBack)finish;

/// 加载用户信息
/// @see[http://open.weibo.com/wiki/2/users/show]
- (void)loadUserWithUid:(NSString *)uid accessToken:(NSString *)token finish:(requestCallBack)finish;

/// 加载微博数据
/// @see [http://open.weibo.com/wiki/2/statuses/friends_timeline]
- (void)loadStutasWithToken:(NSString *)token finish:(requestCallBack)finish;
@end
